import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:test01/okhttp_test/page/indexlogin/telephone_page.dart';


void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    ///禁止程序横屏
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp, //只能纵向
      DeviceOrientation.portraitDown, //只能纵向
    ]);

    return MaterialApp(
      title: '页面一',
      home: new PageOne(),
    );
  }
}


/// 登录页面
class PageOne extends StatelessWidget {

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      body: Container(
        decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage("assets/login_bg.png"),
              fit: BoxFit.cover,
            )
        ),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            ///获取界面宽度
            SizedBox(height: MediaQuery.of(context).padding.top),
            ///返回界面
            GestureDetector(
              onTap: (){
                print("返回");
                // Navigator.pop(context);
              },
              child: Container(
                margin: EdgeInsets.only(left: 16,top: 10),
                child: Icon(Icons.clear,color: Colors.black,size: 28,),
              ),
            ),

            Spacer(),
            Container(
              margin: EdgeInsets.fromLTRB(41, 0, 0, 0),
              child: Text("Hello~",style:TextStyle(
                  decoration: TextDecoration.none,
                  color: Colors.white,
                  fontSize: 23
              ),),
            ),
            Container(
              margin: EdgeInsets.fromLTRB(41, 9, 0, 0),
              child: Text(
                "此刻开始分享你的健身生活和经验吧~",
                style:TextStyle(
                  decoration: TextDecoration.none,
                  color: Color.fromRGBO(255, 255, 255, 1).withOpacity(0.65),
                  fontSize: 14,
                ),),
            ),
            Container(
              margin: EdgeInsets.fromLTRB(41, 37, 0, 0),
              child: Text(
                "选择用以下方式登陆",
                style:TextStyle(
                  decoration: TextDecoration.none,
                  color: Color.fromRGBO(204, 204, 204, 1),
                  fontSize: 14,
                ),),
            ),
            Row(
              children: <Widget>[
                GestureDetector(
                  onTap:(){
                    Fluttertoast.showToast(msg: "进入",toastLength: Toast.LENGTH_SHORT,gravity: ToastGravity.BOTTOM,
                        textColor: Colors.white,
                        fontSize: 16.0
                    );
                    ///界面跳转
                    Navigator.push(context, MaterialPageRoute(builder: (context) {
                      return TelephonePage();
                    }));
                  },
                  child: Container(
                      margin: EdgeInsets.fromLTRB(41, 12, 0, 0),//间距
                      decoration:BoxDecoration(
                        border: Border.all(color:Colors.black, width: 10), // 边色与边宽度
                        color: Colors.black,
                        borderRadius:BorderRadius.circular((40.0)), // 圆角度
                      ),
                      child: Image.asset(
                        "assets/icon/telephone.png",
                        width: 25,
                        height: 25,

                      )
                  ),

                ),
                GestureDetector(
                  onTap: (){
                    print('单击了');
                  },
                  child:  Container(
                      margin: EdgeInsets.fromLTRB(12, 12, 0, 0),
                      decoration:BoxDecoration(
                        border: Border.all(color:Colors.black, width: 10), // 边色与边宽度
                        color: Colors.black,
                        borderRadius:BorderRadius.circular((40.0)), // 圆角度
                      ),
                      child: Image.asset(
                        "assets/icon/wx.png",
                        width: 25,
                        height: 25,
                      )
                  ),
                ),
                Container(
                    margin: EdgeInsets.fromLTRB(12, 12, 0, 0),//间距
                    decoration:BoxDecoration(
                      border: Border.all(color:Colors.black, width: 10), // 边色与边宽度
                      color: Colors.black,
                      borderRadius:BorderRadius.circular((40.0)), // 圆角度
                    ),
                    child: Image.asset(
                      "assets/icon/qq.png",
                      width: 25,
                      height: 25,

                    )
                ),
              ],
            ),
            Container(
                margin: EdgeInsets.fromLTRB(41, 12, 0, 0),
                child: RichText(
                  text: TextSpan(
                      style: DefaultTextStyle.of(context).style,
                      children: <InlineSpan>[
                        TextSpan(
                          text: '登录即视为同意健身的',
                          style: TextStyle(
                            decoration: TextDecoration.none,
                            color: Color.fromRGBO(204, 204, 204, 1),
                            fontSize: 12,
                          ),
                        ),
                        TextSpan(
                          text: '使用条款',
                          style: TextStyle(
                            ///设置为下划线
                            decoration: TextDecoration.underline,
                            ///下划线样式为单实线
                            decorationStyle: TextDecorationStyle.solid,
                            ///下滑线颜色以及透明度
                            decorationColor:Color.fromRGBO(0, 0, 0, 1).withOpacity(0.15),
                            color: Color.fromRGBO(0, 0, 0, 1).withOpacity(0.15),
                            fontSize: 12,
                          ),
                        ),
                        TextSpan(
                          text: '和',
                          style: TextStyle(
                            decoration: TextDecoration.none,
                            color: Color.fromRGBO(204, 204, 204, 1),
                            fontSize: 12,
                          ),),
                        TextSpan(
                          text: '隐私政策',
                          style: TextStyle(
                            ///下划线样式为单实线
                            decorationStyle: TextDecorationStyle.solid,
                            ///下滑线颜色以及透明度
                            decorationColor: Color.fromRGBO(0, 0, 0, 1).withOpacity(0.15),
                            color: Color.fromRGBO(0, 0, 0, 1).withOpacity(0.15),
                            fontSize: 12,
                          ),
                        ),
                      ]),
                )
            ),
            SizedBox(height: 127,)
          ],
        ),


      ),
    );
  }
}






